% Counter-factual Graphs

clc
clear all
close all

load sen_low_beta_original.mat
Stime_original=Stime;
Ftime_sum(:,1)=sum(Ftime(:,:,1),2);
Ftime_sum(:,2)=sum(Ftime(:,:,2),2);
Ftime_sum_original=Ftime_sum;
total_cum_Dtime_original=total_cum_Dtime;
utility_sum_norm_avg_original=utility_sum_norm_avg;
utility_sum_norm_young_original=utility_sum_norm_young;
utility_sum_norm_old_original =utility_sum_norm_old;

load sen_low_beta_delta1_0_delta2_0.mat
Stime_cnt2=Stime;
Ftime_sum(:,1)=sum(Ftime(:,:,1),2);
Ftime_sum(:,2)=sum(Ftime(:,:,2),2);
Ftime_sum_cnt2=Ftime_sum;
total_cum_Dtime_cnt2=total_cum_Dtime;
utility_sum_norm_avg_cnt2=utility_sum_norm_avg;
utility_sum_norm_young_cnt2=utility_sum_norm_young;
utility_sum_norm_old_cnt2=utility_sum_norm_old;

%% Table

end_day=365*2; % in one and half years

% 1. total number of infection
tab(1,1)=total_cum_Dtime_cnt2(end_day,1);
tab(1,2)=total_cum_Dtime_original(end_day,1);

% 2. utility loss per day
tab(2,1)=-(nansum(utility_sum_norm_avg_cnt2(1:end_day,1)))/(end_day)*100;
tab(2,2)=-(nansum(utility_sum_norm_avg_original(1:end_day,1)))/(end_day)*100;




load sen_high_beta_original.mat
Stime_original=Stime;
Ftime_sum(:,1)=sum(Ftime(:,:,1),2);
Ftime_sum(:,2)=sum(Ftime(:,:,2),2);
Ftime_sum_original=Ftime_sum;
total_cum_Dtime_original=total_cum_Dtime;
utility_sum_norm_avg_original=utility_sum_norm_avg;
utility_sum_norm_young_original=utility_sum_norm_young;
utility_sum_norm_old_original =utility_sum_norm_old;

load sen_high_beta_delta1_0_delta2_0.mat
Stime_cnt2=Stime;
Ftime_sum(:,1)=sum(Ftime(:,:,1),2);
Ftime_sum(:,2)=sum(Ftime(:,:,2),2);
Ftime_sum_cnt2=Ftime_sum;
total_cum_Dtime_cnt2=total_cum_Dtime;
utility_sum_norm_avg_cnt2=utility_sum_norm_avg;
utility_sum_norm_young_cnt2=utility_sum_norm_young;
utility_sum_norm_old_cnt2=utility_sum_norm_old;

%% Table

end_day=365*2; % in one and half years

% 1. total number of infection
tab(1,3)=total_cum_Dtime_cnt2(end_day,1);
tab(1,4)=total_cum_Dtime_original(end_day,1);

% 2. utility loss per day
tab(2,3)=-(nansum(utility_sum_norm_avg_cnt2(1:end_day,1)))/(end_day)*100;
tab(2,4)=-(nansum(utility_sum_norm_avg_original(1:end_day,1)))/(end_day)*100;

save ('Output/table3a.mat', 'tab')